/**
 * @FilePath     : /src/lgmg_robots/agv_navigation/agv_navigate/agvWorld/GeometrySrc/direct.cpp
 * @Description  : 实现了移动方向和转向方向类的重载运算符，包括赋值运算符、相等和不相等运算符以及取反运算符。
 *                 MoveDir类用于表示移动方向，TurnDir类用于表示转向方向。每个类都实现了与方向相关的操作。 
 * @Author       : xiujun.yang
 * @Version      : 1.0.0
 * @LastEditors  : haibo haibo.yang@lgmgim.cn
 * @LastEditTime : 2024-12-19 17:47:13
 * @Copyright (c) 2024 by 临工智能信息科技有限公司, All Rights Reserved. 
**/
#include "geometry.h" 

//////////////////////////////////////////////////////////////////////////////
//   Implementation of class "MoveDir".
//
//   Copy constructor =: Assignment of move direction.
//
void MoveDir::operator=(const MoveDir& move_dir) 
{
    move_dir_tag_ = move_dir.move_dir_tag_;
}

//
//   Overloaded operator =: Assignment of move direction.
//
void MoveDir::operator=(MoveDirTag move_dir_tag) 
{
    move_dir_tag_ = move_dir_tag;
}

//
//   overloaded operator ==: Test if 2 objects are identical.
//
bool MoveDir::operator==(const MoveDir& move_dir) const 
{
    return (move_dir_tag_ == move_dir.move_dir_tag_);
}

//
//   overloaded operator !=: Test if 2 objects are not identical.
//
bool MoveDir::operator!=(const MoveDir& move_dir) const 
{
    return (move_dir_tag_ != move_dir.move_dir_tag_);
}


//
//   Overloaded operator ==: Test if the object is of the specified turn
//   direction.
//
bool MoveDir::operator==(MoveDirTag move_dir_tag) const 
{
    return (move_dir_tag_ == move_dir_tag);
}
//
//   Overloaded operator !=: Test if the object is not of the specified
//   turn direction.
//
bool MoveDir::operator!=(MoveDirTag move_dir_tag) const 
{
    return (move_dir_tag_ != move_dir_tag);
}


//
//   Overloaded operator !: Get the opposite turn direction.
//
MoveDir MoveDir::operator!() const 
{
    return (move_dir_tag_ == MoveDirTag::Forward) ? MoveDir(MoveDirTag::Backward)
                                                  : MoveDir(MoveDirTag::Forward);
}


//////////////////////////////////////////////////////////////////////////////
//   Implementation of class "CTurnDir".

//
//   Copy constructor =: Assignment of turn direction.
//
void TurnDir::operator=(const TurnDir& turn_dir) 
{
    turn_dir_tag_ = turn_dir.turn_dir_tag_;
}


//
//   Overloaded operator =: Assignment of turn direction.
//
void TurnDir::operator=(TurnDirTag turn_dir_tag) 
{
    turn_dir_tag_ = turn_dir_tag;
}

//
//   overloaded operator ==: Test if 2 objects are identical.
//
bool TurnDir::operator==(const TurnDir& turn_dir) const 
{
    return (turn_dir_tag_ == turn_dir.turn_dir_tag_);
}

//
//   overloaded operator !=: Test if 2 objects are not identical.
//
bool TurnDir::operator!=(const TurnDir& turn_dir) const 
{
    return (turn_dir_tag_ != turn_dir.turn_dir_tag_);
}

//
//   Overloaded operator ==: Test if the object is of the specified turn
//   direction.
//
bool TurnDir::operator==(TurnDirTag turn_dir_tag) const 
{
    return (turn_dir_tag_ == turn_dir_tag);
}

//
//   Overloaded operator !=: Test if the object is not of the specified
//   turn direction.
//
bool TurnDir::operator!=(TurnDirTag turn_dir_tag) const 
{
    return (turn_dir_tag_ != turn_dir_tag);
}

//
//   Overloaded operator !: Get the opposite turn direction.
//
TurnDir TurnDir::operator!() const 
{
    return (turn_dir_tag_ == TurnDirTag::CounterClockwise) ? TurnDir(TurnDirTag::Clockwise)
                                                           : TurnDir(TurnDirTag::CounterClockwise);
}
